-
Notifications
You must be signed in to change notification settings - Fork 26
[feat]: allow adding resource policy to dynamodb tables #154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat]: allow adding resource policy to dynamodb tables #154
Conversation
|
Hi @shabbskagalwala. Thanks for your PR. I'm waiting for a aws-controllers-k8s member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/ok-to-test |
f868396 to
2266683
Compare
2266683 to
7f28e30
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much @shabbskagalwala ! this looks great overall - i left a few comments in line :)
pkg/resource/table/hooks.go
Outdated
| if ackcompare.HasNilDifference(a.ko.Spec.ResourcePolicy, b.ko.Spec.ResourcePolicy) { | ||
| delta.Add("Spec.ResourcePolicy", a.ko.Spec.ResourcePolicy, b.ko.Spec.ResourcePolicy) | ||
| } else if a.ko.Spec.ResourcePolicy != nil && b.ko.Spec.ResourcePolicy != nil { | ||
| if *a.ko.Spec.ResourcePolicy != *b.ko.Spec.ResourcePolicy { | ||
| delta.Add("Spec.ResourcePolicy", a.ko.Spec.ResourcePolicy, b.ko.Spec.ResourcePolicy) | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this block the same the original generated code when we set compare.is_ignore: false ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually we do have a way to parse IAM policies that gets formatted/reformatted by the AWS APIs, checkout https://github.com/aws-controllers-k8s/iam-controller/blob/main/pkg/resource/role/hooks.go#L398-L432
| } | ||
| if !delta.DifferentExcept("Spec.Tags") { | ||
|
|
||
| // ResourcePolicy can be updated independently of table state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shabbskagalwala can we also get some basic e2e tests for this feature? a test case here would be great https://github.com/aws-controllers-k8s/dynamodb-controller/blob/main/test/e2e/tests/test_table.py
Co-authored-by: Amine <[email protected]>
78a6f96 to
2c79edd
Compare
|
/retest |
1 similar comment
|
/retest |
8aaf651 to
37b1875
Compare
|
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shabbskagalwala Thanks for the contribution!
| ) | ||
| rm.metrics.RecordAPICall("DELETE", "DeleteResourcePolicy", err) | ||
| if err != nil { | ||
| var policyNotFoundErr *svcsdktypes.PolicyNotFoundException |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
p: It would be good to add a unit test validating this behavior.
37b1875 to
fb7f703
Compare
|
@shabbskagalwala: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you 👍
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: a-hilaly, shabbskagalwala The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…155) Issue #, if available: aws-controllers-k8s/community#2655 Description of changes: Release PR for #154 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Issue #, if available: aws-controllers-k8s/community#2655
Description of changes:
Allows to add a resource policy to a dynamodb table.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.